From: Richard M. Stallman Date: Thu, 10 Jun 1993 21:31:56 +0000 (+0000) Subject: (hack-one-local-variable): Treat ...-hook(s) and ..-function(s) X-Git-Tag: archive/raspbian/1%29.2+1-2+rpi1^2~5^2~95434 X-Git-Url: https://dgit.raspbian.org/%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:///%22http:/www.example.com/cgi/%22https:/www.github.com/%22bookmarks:/?a=commitdiff_plain;h=7d3221d7e32e0c9b359d46fd7a74e0d5b220dbdd;p=emacs.git (hack-one-local-variable): Treat ...-hook(s) and ..-function(s) like setting the `eval' variable. --- diff --git a/lisp/files.el b/lisp/files.el index 37ad1c980bc..047bea3c2df 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1011,7 +1011,9 @@ If `enable-local-variables' is nil, this function does not check for a ((memq var ignored-local-variables) nil) ;; "Setting" eval means either eval it or do nothing. - ((eq var 'eval) + ;; Likewise for setting hook variables. + ((or (eq var 'eval) + (string-match "-hooks?$\\|-functions?$" (symbol-name var))) (if (and (not (string= (user-login-name) "root")) (or (eq enable-local-eval t) (and enable-local-eval @@ -1021,9 +1023,12 @@ If `enable-local-variables' is nil, this function does not check for a (beginning-of-line) (set-window-start (selected-window) (point))) (setq enable-local-eval - (y-or-n-p (format "Process `eval' local variable in file %s? " + (y-or-n-p (format "Process `eval' or hook local variables in file %s? " (file-name-nondirectory buffer-file-name)))))))) - (save-excursion (eval val)) + (if (eq var 'eval) + (save-excursion (eval val)) + (make-local-variable var) + (set var val)) (message "Ignoring `eval:' in file's local variables"))) ;; Ordinary variable, really set it. (t (make-local-variable var)